/******************************************************************************
 * 
 * Announce: CSharpKit, Basic algorithms, components and definitions.
 *           Copyright (C) ShenYongchen.
 *           All rights reserved.
 *   Author: 申永辰.郑州 (shenyczz@163.com)
 *  WebSite: http://gitee.com/shenyczz/csharp_csk
 *
 * THIS CODE IS LICENSED UNDER THE MIT LICENSE (MIT).
 * THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
 * IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
 * PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 * 
******************************************************************************/
using System;
using System.Threading.Tasks;
using CSharpKit.Numerics.Providers.LinearAlgebra;

namespace CSharpKit.Numerics
{
    /// <summary>
    /// Sets parameters for the library.
    /// </summary>
    public class Control
    {
        static Control()
        {
            _maxDegreeOfParallelism = Environment.ProcessorCount;
            _parallelizeOrder = 64;
            _parallelizeElements = 300;

            // Random Numbers & Distributions
            // CheckDistributionParameters = true;

            // Parallelization & Threading
            // ThreadSafeRandomNumberGenerators = true;

            // TaskScheduler = System.Threading.Tasks.TaskScheduler.Default;
        }

        static int _maxDegreeOfParallelism;
        static int _parallelizeOrder;
        static int _parallelizeElements;
        static string _nativeProviderHintPath;
        

        /// <summary>
        /// 并行最大度
        /// </summary>
        /// <value></value>
        public static int MaxDegreeOfParallelism
        {
            get { return _maxDegreeOfParallelism; }
            set
            {
                _maxDegreeOfParallelism = System.Math.Max(1, System.Math.Min(1024, value));

                // Reinitialize providers:
                LinearAlgebraControl.Provider.InitializeVerify();
                // FourierTransformControl.Provider.InitializeVerify();
            }
        }


        //}}@@@
    }


}
